<!-- 举报 -->
<template>
	<view class="reportcss">
		<view class="list-box">
			<view class="martcss">
				<view class="re">
					
				</view> {{title1}}
			</view>
			<view class="text-box">
				<textarea v-model="list.text" height="200" placeholder="请提供举报的具体原因,方便客服核实,恶意举报会有封号处罚" border='none'></textarea>
			</view>
			<view class="martcss">
				<view class="re">
					
				</view> {{title2}}
			</view>
			<view class="phone-box">
				<input
				    placeholder="请填写您的手机号码,方便客服与您核实"
				    border="none"
					type="number"
					maxlength=11
				    v-model="list.phone"
				 ></input>
			</view>
		</view>
		<view class="save-box" @click="saveBnt()">
			提交
		</view>
	</view>
</template>

<script>
	import * as user from '@/api/user.js'
	export default {
		data(){
			return{
				title1:'举报原因',
				title2:'联系电话',
				list:{
					jubao_id: '',
					text:'',
					phone:'',
					type:uni.getStorageSync('Type'),
				}
			}
		},
		onLoad(params) {
			this.list.jubao_id =params.id

		},
		methods:{
			//提交
			saveBnt(){

				if(!this.list.text){
					this.$tools.toast('请填写举报内容')
				}else if(!this.list.phone){
					this.$tools.toast('请填写手机号')
				}else if(this.list.phone.length < 11){
					this.$tools.toast('请填写正确的手机号')
				}else{
					user.complaint(this.list).then(res=>{
						this.$tools.succend('举报成功!')
						setTimeout(res=>{
							uni.navigateBack({
								data: 1
							})
						},500)
					})
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.reportcss{
		.list-box {
			.martcss{
				margin-top: 20px;
				display: flex;
				align-items: center;
				padding-left: 20rpx;
				.re {
					width: 10rpx;
					height: 20rpx;
					background: #FF6600;
					margin-right: 10rpx;
				}
			}
			.phone-box {
				display: flex;
				align-items: center;
				border-bottom: 2rpx solid #f4f4f4;
				background: #ffffff;
				padding: 30rpx;
				margin-top: 20px;
				input {
					width: 100%;
				}
			}
			.text-box {
				background: #ffffff;
				padding: 30rpx 20rpx 30rpx 20rpx;
				margin-top: 20px;
				textarea {
					width: 100%;
				}
			}
		}
		.save-box {
			margin-top: 200rpx;
			width: 696rpx;
			height: 100rpx;
			background: #FF6600;
			border-radius: 24rpx;
			font-size: 36rpx;
			font-weight: bold;
			color: #FFFFFF;
			line-height: 100rpx;
			text-align: center;
			margin-left: calc(50% - 348rpx);
		}
		
	}
</style>
